#ifndef DEVICE_H
#define DEVICE_H

#include <stdint.h>
#include <vector>

#include "core/common/Packet.h"
#include "threading/Mutex.h"

class Controller;
class Server;

class Device
{
public:
    static const uint8_t     gridSize = 8;

                             Device(Server* server);
                             ~Device();

    bool                     command(const Controller* controller, CommandPacket* command);
    bool                     updateController();
    bool                     release(const Controller* controller);
    bool                     request(Controller* controller);

private:
    static const uint8_t     moveLimit = 5;

    Mutex                    mutex_;

    Server*                  pServer_;

    int                      iX_, iY_;
    uint8_t                  moveCount;

    std::vector<Controller*> queue_;
};

#endif // DEVICE_H
